+2000-07-23 Tor Lillqvist <tml@iki.fi>
+
+ Win32 build setup:
+
+ * makefile.mingw.in
+ * pixops/makefile.mingw.in
+ * pixbuf_*.def: New files.
+
+ * Makefile.am
+ * pixops/Makefile.am: Add them. Add rule to generate makefile.mingw.
+
+ * gdk-pixbuf-io.c (gtk_win32_get_installation_directory):
+ New function, to get the GTK+ installation directory from
+ the Windows Registry, where the installation program
+ for whatever software includes GTK+ has stored it.
+
+ Used to avoid having hardcoding the directory where to look for
+ loaders. This function is needed by gtk, too, so it should
+ really be just in one place. Maybe a small static library
+ one level up from here?
+
+ * gdk-pixbuf-animation.c (gdk_pixbuf_animation_new_from_file)
+ * gdk-pixbuf-io.c (gdk_pixbuf_new_from_file):
+ Open file in binary mode. This *is* standard C. (No-op on Unix,
+ of course.)
+
+ * io-jpeg.c: If we don't HAVE_SIGSETJMP, use normal setjmp().
+
+ * io-tiff.c: Use g_get_tmp_dir(). If we don't HAVE_MKSTEMP, use
+ mktemp() and open().
+ (gdk_pixbuf__tiff_image_stop_load): g_free() also the tempname.
+
+ * pixops/*.S: The Gas from mingw32 doesn't like the .type
+ pseudo-op. Conditionalise on __MINGW32__, but probably
+ should conditionalise on Gas version instead? Or could we
+ do without .type on all systems?
+
+ * pixops/timescale.c: Use g_get_current_time()
+ instead of gettimeofday().
+
Sat Jul 22 10:57:22 2000 Owen Taylor <otaylor@redhat.com>
* Makefile.am (test_gdk_pixbuf_LDADD): Remove -lgmodule
noinst_HEADERS = \
gdk-pixbuf-io.h \
gdk-pixbuf-private.h
+
+EXTRA_DIST = \
+ makefile.mingw \
+ makefile.mingw.in \
+ gdk_pixbuf.def \
+ pixbuf_ico.def \
+ pixbuf_pnm.def \
+ pixbuf_xpm.def \
+ pixbuf_bmp.def \
+ pixbuf_jpeg.def \
+ pixbuf_ras.def \
+ pixbuf_gif.def \
+ pixbuf_png.def \
+ pixbuf_tiff.def
+
+makefile.mingw: $(top_builddir)/config.status $(top_srcdir)/gdk-pixbuf/makefile.mingw.in
+ cd $(top_builddir) && CONFIG_FILES=gdk-pixbuf/$@ CONFIG_HEADERS= $(SHELL) ./config.status
g_return_val_if_fail (filename != NULL, NULL);
- f = fopen (filename, "r");
+ f = fopen (filename, "rb");
if (!f)
return NULL;
#include "gdk-pixbuf-private.h"
#include "gdk-pixbuf-io.h"
+#ifdef G_OS_WIN32
+#define STRICT
+#include <windows.h>
+#endif
+
\f
static gboolean
return return_value;
}
+#ifdef G_OS_WIN32
+
+/* What would be the right place for this function? Also
+ * gtk needs this function (to find the gtkrc and themes).
+ * But it seems stupid for the gdk-pixbuf DLL to depend
+ * on the gtk DLL. Should it be in the gdk DLL? Or should we
+ * have a small static library at the top gtk+ level?
+ */
+
+static gchar *
+gtk_win32_get_installation_directory (void)
+{
+ static gboolean been_here = FALSE;
+ static gchar gtk_installation_dir[200];
+ gchar win_dir[100];
+ HKEY reg_key = NULL;
+ DWORD type;
+ DWORD nbytes = sizeof (gtk_installation_dir);
+
+ if (been_here)
+ return gtk_installation_dir;
+
+ been_here = TRUE;
+
+ if (RegOpenKeyEx (HKEY_LOCAL_MACHINE, "Software\\GNU\\GTk+", 0,
+ KEY_QUERY_VALUE, ®_key) != ERROR_SUCCESS
+ || RegQueryValueEx (reg_key, "InstallationDirectory", 0,
+ &type, gtk_installation_dir, &nbytes) != ERROR_SUCCESS
+ || type != REG_SZ)
+ {
+ /* Uh oh. Use hard-coded %WinDir%\gtk+ value */
+ GetWindowsDirectory (win_dir, sizeof (win_dir));
+ sprintf (gtk_installation_dir, "%s\\gtk+", win_dir);
+ }
+
+ if (reg_key != NULL)
+ RegCloseKey (reg_key);
+
+ return gtk_installation_dir;
+}
+
+static char *
+get_libdir (void)
+{
+ static char *libdir = NULL;
+
+ if (libdir == NULL)
+ libdir = g_strdup_printf (gtk_win32_get_installation_directory (),
+ G_DIR_SEPARATOR_S,
+ "loaders",
+ NULL);
+
+ return libdir;
+}
+
+#define PIXBUF_LIBDIR get_libdir ()
+
+#endif
+
/* actually load the image handler - gdk_pixbuf_get_module only get a */
/* reference to the module to load, it doesn't actually load it */
/* perhaps these actions should be combined in one function */
g_return_val_if_fail (filename != NULL, NULL);
- f = fopen (filename, "r");
+ f = fopen (filename, "rb");
if (!f)
return NULL;
--- /dev/null
+EXPORTS
+ gdk_pixbuf_add_alpha
+ gdk_pixbuf_animation_get_frames
+ gdk_pixbuf_animation_get_height
+ gdk_pixbuf_animation_get_num_frames
+ gdk_pixbuf_animation_get_type
+ gdk_pixbuf_animation_get_width
+ gdk_pixbuf_animation_new_from_file
+ gdk_pixbuf_animation_ref
+ gdk_pixbuf_animation_unref
+ gdk_pixbuf_composite
+ gdk_pixbuf_composite_color
+ gdk_pixbuf_composite_color_simple
+ gdk_pixbuf_copy
+ gdk_pixbuf_copy_area
+ gdk_pixbuf_frame_get_action
+ gdk_pixbuf_frame_get_delay_time
+ gdk_pixbuf_frame_get_pixbuf
+ gdk_pixbuf_frame_get_x_offset
+ gdk_pixbuf_frame_get_y_offset
+ gdk_pixbuf_get_bits_per_sample
+ gdk_pixbuf_get_colorspace
+ gdk_pixbuf_get_has_alpha
+ gdk_pixbuf_get_height
+ gdk_pixbuf_get_module
+ gdk_pixbuf_get_n_channels
+ gdk_pixbuf_get_pixels
+ gdk_pixbuf_get_rowstride
+ gdk_pixbuf_get_type
+ gdk_pixbuf_get_width
+ gdk_pixbuf_init
+ gdk_pixbuf_load_module
+ gdk_pixbuf_new
+ gdk_pixbuf_new_from_data
+ gdk_pixbuf_new_from_file
+ gdk_pixbuf_new_from_xpm_data
+ gdk_pixbuf_postinit
+ gdk_pixbuf_preinit
+ gdk_pixbuf_ref
+ gdk_pixbuf_scale
+ gdk_pixbuf_scale_simple
+ gdk_pixbuf_unref
#include "gdk-pixbuf-private.h"
#include "gdk-pixbuf-io.h"
+#ifndef HAVE_SIGSETJMP
+#define sigjmp_buf jmp_buf
+#define sigsetjmp(jb, x) setjmp(jb)
+#define siglongjmp longjmp
+#endif
\f
/* we are a "source manager" as far as libjpeg is concerned */
#include "gdk-pixbuf-private.h"
#include "gdk-pixbuf-io.h"
+#ifdef G_OS_WIN32
+#include <fcntl.h>
+#define O_RDWR _O_RDWR
+#endif
\f
typedef struct _TiffData TiffData;
{
TiffData *context;
gint fd;
+ gchar *tmp = g_get_tmp_dir ();
context = g_new (TiffData, 1);
context->prepare_func = prepare_func;
context->update_func = update_func;
context->user_data = user_data;
context->all_okay = TRUE;
- context->tempname = g_strdup ("/tmp/gdkpixbuf-tif-tmp.XXXXXX");
+ context->tempname =
+ g_strconcat (tmp,
+ tmp[strlen (tmp)] == G_DIR_SEPARATOR ? G_DIR_SEPARATOR_S : "",
+ "gdkpixbuf-tif-tmp.XXXXXX",
+ NULL);
+#ifdef HAVE_MKSTEMP
fd = mkstemp (context->tempname);
+#else
+ mktemp (context->tempname);
+ fd = open (context->tempname, O_RDWR);
+#endif
if (fd < 0) {
g_free (context);
return NULL;
fclose (context->file);
unlink (context->tempname);
+ g_free (context->tempname);
g_free ((TiffData *) context);
}
--- /dev/null
+## Makefile for building the gdk_pixbuf DLL with gcc on Win32
+## Use: make -f makefile.mingw
+
+TOP = ../..
+
+include ../build/win32/make.mingw
+
+# Possibly override GTK+ version from build/win32/module.defs
+GTK_VER = @GTK_MAJOR_VERSION@.@GTK_MINOR_VERSION@
+
+OPTIMIZE = -g
+
+INCLUDES = -I . -I ..
+DEPCFLAGS = $(GLIB_CFLAGS)
+
+all : \
+ ../config.h \
+ gdk_pixbuf-$(GTK_VER).dll \
+ pixbufloader_png.dll \
+ pixbufloader_jpeg.dll \
+ pixbufloader_gif.dll \
+ pixbufloader_ico.dll \
+ pixbufloader_ras.dll \
+ pixbufloader_tiff.dll \
+ pixbufloader_xpm.dll \
+ pixbufloader_pnm.dll \
+ pixbufloader_bmp.dll \
+ test-gdk-pixbuf.exe
+
+gdk_pixbuf_OBJECTS = \
+ gdk-pixbuf.o \
+ gdk-pixbuf-animation.o \
+ gdk-pixbuf-data.o \
+ gdk-pixbuf-io.o \
+ gdk-pixbuf-scale.o \
+ gdk-pixbuf-util.o \
+ pixops/libpixops.a
+
+../config.h : ../config.h.win32
+ cp $< $@
+
+gdk_pixbuf-$(GTK_VER).dll : $(gdk_pixbuf_OBJECTS) gdk_pixbuf.def
+ $(GLIB)/build-dll gdk_pixbuf $(GTK_VER) gdk_pixbuf.def $(gdk_pixbuf_OBJECTS) -L ../gdk -lgdk-$(GTK_VER) $(GLIB_LIBS)
+
+pixops/libpixops.a :
+ cd pixops && $(MAKE) -f makefile.mingw libpixops.a
+
+pixbufloader_png_OBJECTS = io-png.o
+
+pixbufloader_png.dll : $(pixbufloader_png_OBJECTS) pixbufloader_png.def
+ $(GLIB)/build-dll pixbufloader_png - pixbuf_png.def $(pixbufloader_png_OBJECTS) -L . -lgdk_pixbuf-$(GTK_VER) $(GLIB_LIBS) $(PNG_LIBS)
+
+io-png.o : io-png.c
+ $(CC) $(CFLAGS) $(PNG_CFLAGS) -c $<
+
+pixbufloader_jpeg_OBJECTS = io-jpeg.o
+
+pixbufloader_jpeg.dll : $(pixbufloader_jpeg_OBJECTS) pixbufloader_jpeg.def
+ $(GLIB)/build-dll pixbufloader_jpeg - pixbuf_jpeg.def $(pixbufloader_jpeg_OBJECTS) -L . -lgdk_pixbuf-$(GTK_VER) $(GLIB_LIBS) $(JPEG_LIBS)
+
+io-jpeg.o : io-jpeg.c
+ $(CC) $(CFLAGS) $(JPEG_CFLAGS) -c $<
+
+pixbufloader_gif_OBJECTS = io-gif.o
+
+pixbufloader_gif.dll : $(pixbufloader_gif_OBJECTS) pixbufloader_gif.def
+ $(GLIB)/build-dll pixbufloader_gif - pixbuf_gif.def $(pixbufloader_gif_OBJECTS) -L . -lgdk_pixbuf-$(GTK_VER) $(GLIB_LIBS)
+
+pixbufloader_ico_OBJECTS = io-ico.o
+
+pixbufloader_ico.dll : $(pixbufloader_ico_OBJECTS) pixbufloader_ico.def
+ $(GLIB)/build-dll pixbufloader_ico - pixbuf_ico.def $(pixbufloader_ico_OBJECTS) -L . -lgdk_pixbuf-$(GTK_VER) $(GLIB_LIBS)
+
+pixbufloader_ras_OBJECTS = io-ras.o
+
+pixbufloader_ras.dll : $(pixbufloader_ras_OBJECTS) pixbufloader_ras.def
+ $(GLIB)/build-dll pixbufloader_ras - pixbuf_ras.def $(pixbufloader_ras_OBJECTS) -L . -lgdk_pixbuf-$(GTK_VER) $(GLIB_LIBS)
+
+pixbufloader_tiff_OBJECTS = io-tiff.o
+
+pixbufloader_tiff.dll : $(pixbufloader_tiff_OBJECTS) pixbufloader_tiff.def
+ $(GLIB)/build-dll pixbufloader_tiff - pixbuf_tiff.def $(pixbufloader_tiff_OBJECTS) -L . -lgdk_pixbuf-$(GTK_VER) $(GLIB_LIBS) $(TIFF_LIBS) $(JPEG_LIBS) $(ZLIB_LIBS)
+
+io-tiff.o : io-tiff.c
+ $(CC) $(CFLAGS) $(TIFF_CFLAGS) -c $<
+
+pixbufloader_xpm_OBJECTS = io-xpm.o
+
+pixbufloader_xpm.dll : $(pixbufloader_xpm_OBJECTS) pixbufloader_xpm.def
+ $(GLIB)/build-dll pixbufloader_xpm - pixbuf_xpm.def $(pixbufloader_xpm_OBJECTS) -L . -lgdk_pixbuf-$(GTK_VER) $(GLIB_LIBS)
+
+pixbufloader_pnm_OBJECTS = io-pnm.o
+
+pixbufloader_pnm.dll : $(pixbufloader_pnm_OBJECTS) pixbufloader_pnm.def
+ $(GLIB)/build-dll pixbufloader_pnm - pixbuf_pnm.def $(pixbufloader_pnm_OBJECTS) -L . -lgdk_pixbuf-$(GTK_VER) $(GLIB_LIBS)
+
+pixbufloader_bmp_OBJECTS = io-bmp.o
+
+pixbufloader_bmp.dll : $(pixbufloader_bmp_OBJECTS) pixbufloader_bmp.def
+ $(GLIB)/build-dll pixbufloader_bmp - pixbuf_bmp.def $(pixbufloader_bmp_OBJECTS) -L . -lgdk_pixbuf-$(GTK_VER) $(GLIB_LIBS)
+
+test-gdk-pixbuf.exe : test-gdk-pixbuf.o gdk_pixbuf-$(GTK_VER).dll
+ $(CC) $(CFLAGS) -o $@ test-gdk-pixbuf.o -L . -lgdk_pixbuf-$(GTK_VER) $(GTK_LIBS) $(GLIB_LIBS)
+
+# Hack to get an updated makefile.mingw automatically after updating
+# makefile.mingw.in. Only for developer use.
+makefile.mingw: makefile.mingw.in
+ sed -e 's,@GTK_MAJOR[_]VERSION@,@GTK_MAJOR_VERSION@,' \
+ -e 's,@GTK_MINOR[_]VERSION@,@GTK_MINOR_VERSION@,' <$< >$@
--- /dev/null
+EXPORTS
+ gdk_pixbuf__bmp_image_load
+ gdk_pixbuf__bmp_image_begin_load
+ gdk_pixbuf__bmp_image_stop_load
+ gdk_pixbuf__bmp_image_load_increment
--- /dev/null
+EXPORTS
+ gdk_pixbuf__gif_image_load
+ gdk_pixbuf__gif_image_begin_load
+ gdk_pixbuf__gif_image_stop_load
+ gdk_pixbuf__gif_image_load_increment
+ gdk_pixbuf__gif_image_load_animation
--- /dev/null
+EXPORTS
+ gdk_pixbuf__ico_image_load
+ gdk_pixbuf__ico_image_begin_load
+ gdk_pixbuf__ico_image_stop_load
+ gdk_pixbuf__ico_image_load_increment
--- /dev/null
+EXPORTS
+ gdk_pixbuf__jpeg_image_load
+ gdk_pixbuf__jpeg_image_begin_load
+ gdk_pixbuf__jpeg_image_stop_load
+ gdk_pixbuf__jpeg_image_load_increment
--- /dev/null
+EXPORTS
+ gdk_pixbuf__png_image_load
+ gdk_pixbuf__png_image_begin_load
+ gdk_pixbuf__png_image_stop_load
+ gdk_pixbuf__png_image_load_increment
--- /dev/null
+EXPORTS
+ gdk_pixbuf__pnm_image_load
+ gdk_pixbuf__pnm_image_begin_load
+ gdk_pixbuf__pnm_image_stop_load
+ gdk_pixbuf__pnm_image_load_increment
--- /dev/null
+EXPORTS
+ gdk_pixbuf__ras_image_load
+ gdk_pixbuf__ras_image_begin_load
+ gdk_pixbuf__ras_image_stop_load
+ gdk_pixbuf__ras_image_load_increment
--- /dev/null
+EXPORTS
+ gdk_pixbuf__tiff_image_load
+ gdk_pixbuf__tiff_image_begin_load
+ gdk_pixbuf__tiff_image_stop_load
+ gdk_pixbuf__tiff_image_load_increment
--- /dev/null
+EXPORTS
+ gdk_pixbuf__xpm_image_load
+ gdk_pixbuf__xpm_image_load_xpm_data
$(mmx_sources)
EXTRA_DIST = \
- DETAILS
\ No newline at end of file
+ DETAILS \
+ makefile.mingw \
+ makefile.mingw.in
+
+makefile.mingw: $(top_builddir)/config.status $(top_srcdir)/gdk-pixbuf/pixops/makefile.mingw.in
+ cd $(top_builddir) && CONFIG_FILES=gdk-pixbuf/pixops/$@ CONFIG_HEADERS= $(SHELL) ./config.status
+
gcc2_compiled.:
.text
.align 16
+
+#ifndef __MINGW32__
+
.globl pixops_composite_line_22_4a4_mmx
.type pixops_composite_line_22_4a4_mmx,@function
+pixops_composite_line_22_4a4_mmx:
+
+#else
+
+.globl _pixops_composite_line_22_4a4_mmx
+_pixops_composite_line_22_4a4_mmx:
+
+#endif
/*
* Arguments
*
* xinit: 32(%ebp)
*
*/
-pixops_composite_line_22_4a4_mmx:
/*
* Function call entry
*/
gcc2_compiled.:
.text
.align 16
+
+#ifndef __MINGW32__
+
.globl pixops_composite_line_color_22_4a4_mmx
.type pixops_composite_line_color_22_4a4_mmx,@function
+pixops_composite_line_color_22_4a4_mmx:
+
+#else
+
+.globl _pixops_composite_line_color_22_4a4_mmx
+_pixops_composite_line_color_22_4a4_mmx:
+
+#endif
/*
* Arguments
*
* colors: 44(%ebp)
*
*/
-pixops_composite_line_color_22_4a4_mmx:
+
/*
* Function call entry
*/
gcc2_compiled.:
.text
.align 16
+
+#ifndef __MINGW32__
+
.globl pixops_have_mmx
.type pixops_have_mmx,@function
-
pixops_have_mmx:
+
+#else
+
+.globl _pixops_have_mmx
+_pixops_have_mmx:
+
+#endif
+
push %ebx
# Check if bit 21 in flags word is writeable
--- /dev/null
+## Makefile for building libpixops.a with gcc on Win32
+## Use: make -f makefile.mingw
+
+TOP = ../../..
+
+include $(TOP)/build/win32/make.mingw
+
+# Possibly override GTK+ version from build/win32/module.defs
+GTK_VER = @GTK_MAJOR_VERSION@.@GTK_MINOR_VERSION@
+
+OPTIMIZE = -g
+
+INCLUDES = -I .. -I ../..
+DEPCFLAGS = $(GLIB_CFLAGS) $(PNG_CFLAGS) $(ZLIB_CFLAGS) $(JPEG_CLFAGS) $(TIFF_CFLAGS)
+
+all : \
+ ../../config.h \
+ libpixops.a \
+ timescale.exe
+
+libpixops_OBJECTS = \
+ pixops.o \
+ have_mmx.o \
+ scale_line_22_33_mmx.o \
+ composite_line_22_4a4_mmx.o \
+ composite_line_color_22_4a4_mmx.o
+
+../../config.h : ../../config.h.win32
+ cp $< $@
+
+libpixops.a : $(libpixops_OBJECTS)
+ ar rv $@ $?
+
+timescale.exe : timescale.o libpixops.a
+ $(CC) $(CFLAGS) -o $@ timescale.o libpixops.a $(GLIB_LIBS)
+
+makefile.mingw: makefile.mingw.in
+ sed -e 's,@GTK_MAJOR[_]VERSION@,@GTK_MAJOR_VERSION@,' \
+ -e 's,@GTK_MINOR[_]VERSION@,@GTK_MINOR_VERSION@,' <$< >$@
+
gcc2_compiled.:
.text
.align 16
+
+#ifndef __MINGW32__
+
.globl pixops_scale_line_22_33_mmx
.type pixops_scale_line_22_33_mmx,@function
+pixops_scale_line_22_33_mmx:
+
+#else
+
+.globl _pixops_scale_line_22_33_mmx
+_pixops_scale_line_22_33_mmx:
+
+#endif
/*
* Arguments
*
* xinit: 32(%ebp)
*
*/
-pixops_scale_line_22_33_mmx:
+
/*
* Function call entry
*/
-#include <unistd.h>
+#include <glib.h>
#include <string.h>
-#include <sys/time.h>
#include <stdlib.h>
#include <stdio.h>
+
#include "pixops.h"
-struct timeval start_time;
+static GTimeVal start_time;
void start_timing (void)
{
- gettimeofday (&start_time, NULL);
+ g_get_current_time (&start_time);
}
double
stop_timing (const char *test, int iterations, int bytes)
{
- struct timeval stop_time;
+ GTimeVal stop_time;
double msecs;
- gettimeofday (&stop_time, NULL);
+ g_get_current_time (&stop_time);
if (stop_time.tv_usec < start_time.tv_usec)
{
stop_time.tv_usec += 1000000;